Pass reportActions as param to shouldShowReportActionNotification#95318
Conversation
|
@eVoloshchak Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
This PR adds a new |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0e9cb8fc2e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
| const reportAttributesRef = useRef(reportAttributes); | ||
| reportAttributesRef.current = reportAttributes; | ||
|
|
||
| const [reportActions] = useOnyx(ONYXKEYS.COLLECTION.REPORT_ACTIONS); |
There was a problem hiding this comment.
I am actually not sure about this one, the component does render null but still adding the largest collection useOnyx will execute this path often. So I wonder if the connectWithoutView wouldnt actually be better here 🤔 @tgolen @luacmartins @bernhardoj
There was a problem hiding this comment.
Well, it looks to me like it's only using the report actions of a single report (eg. from const topmostReportID = Navigation.getTopmostReportId();), and it's only trying to get the getOneTransactionThreadReportAction() for that report.
I would prefer at least using a selector here to only subscribe to one report's actions, instead of the entire collection.
It would be even better if there was a hook or a selector (I am pretty sure there might be already) that returns the one-transaction-thread-report-action
I do agree with you though that we should be very careful of adding a subscription this large to a top-level navigator. I don't know what kind of performance impact that would have.
There was a problem hiding this comment.
Done. Now we pass the one-transaction report ID only.
It would be even better if there was a hook or a selector (I am pretty sure there might be already)
I don't see one, so I created the hook.
| }); | ||
|
|
||
| let allReportActions: OnyxCollection<ReportActions>; | ||
| Onyx.connectWithoutView({ |
There was a problem hiding this comment.
Add a comment to indicate why it's OK to use this instead of using useOnyx()
There was a problem hiding this comment.
I reuse the comment from the above one
// We do not depend on updates on the UI for notifications, so we can use
connectWithoutViewhere.
There was a problem hiding this comment.
OK, that comment is a little confusing. How about this?
Push notifications aren't rendered using React, so it's impossible to access Onyx data with
useOnyx(), therefore, it's OK to useconnectWithoutView()here.
| const reportAttributesRef = useRef(reportAttributes); | ||
| reportAttributesRef.current = reportAttributes; | ||
|
|
||
| const [reportActions] = useOnyx(ONYXKEYS.COLLECTION.REPORT_ACTIONS); |
There was a problem hiding this comment.
Well, it looks to me like it's only using the report actions of a single report (eg. from const topmostReportID = Navigation.getTopmostReportId();), and it's only trying to get the getOneTransactionThreadReportAction() for that report.
I would prefer at least using a selector here to only subscribe to one report's actions, instead of the entire collection.
It would be even better if there was a hook or a selector (I am pretty sure there might be already) that returns the one-transaction-thread-report-action
I do agree with you though that we should be very careful of adding a subscription this large to a top-level navigator. I don't know what kind of performance impact that would have.
JmillsExpensify
left a comment
There was a problem hiding this comment.
No product review required.
tgolen
left a comment
There was a problem hiding this comment.
I love the hook! Thats brilliant. Thanks!
| }); | ||
|
|
||
| let allReportActions: OnyxCollection<ReportActions>; | ||
| Onyx.connectWithoutView({ |
There was a problem hiding this comment.
OK, that comment is a little confusing. How about this?
Push notifications aren't rendered using React, so it's impossible to access Onyx data with
useOnyx(), therefore, it's OK to useconnectWithoutView()here.
|
Updated the comment and left only 1 comment because it's true for all |
mountiny
left a comment
There was a problem hiding this comment.
@eVoloshchak Can you please review and test this PR?
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppvideo_2026-07-08_15-16-30.mp4Android: mWeb ChromeScreen.Recording.2026-07-08.at.15.05.33.moviOS: HybridAppScreen.Recording.2026-07-08.at.14.56.58.moviOS: mWeb SafariScreen.Recording.2026-07-08.at.14.58.04.movMacOS: Chrome / SafariScreen.Recording.2026-07-08.at.14.53.57.mov |
@bernhardoj, this still shows the notification after step 4 for me (notice the tab sound icon, notifications are hidden when screen recording, but they're shown normally) Screen.Recording.2026-07-08.at.07.12.16.mov |
@eVoloshchak oh, I should be more specific, you need the tab to be focused (sometimes I even need to click into the app), otherwise App/src/libs/actions/Report/index.ts Lines 4613 to 4617 in 92303dd Added a note on the QA Steps |
|
I did not review but approvals are in and checks are green so I will merge now |
|
🚧 mountiny has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
Explanation of Change
Fixed Issues
$ #73651
PROPOSAL:
Tests
Same as QA Steps
Offline tests
Same as QA Steps
QA Steps
Prerequisite:
NOTE: if you open both users on the same device (even with different tab/browser), on step 4, make sure the User A tab is open and focused (you can click into the app to make it focus)
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)Avatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
w.mp4